package com.lw.question09;

import java.util.Scanner;

/**
 * @author LW
 * @2020/9/16 20:27
 */
public class 停电2 {
    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        String f = scanner.nextLine();
        String k = scanner.nextLine();
        String[] jia7 = f.split("/");
        String[] jia8 = k.split("/");
        int f7 = Integer.parseInt(jia7[1]);
        int f8 = Integer.parseInt(jia8[1]);

        int[] d1={1,3,6,10,15,21,28};
        int[] d2 ={5,14,24};
        int t7 = 0;
        int t8 = 0;
        //七月放假时，停电的天数
        for (int i = 0; i < d1.length; i++) {
            if (f7<=d1[i]){
                t7=i+1;
            }
        }
        //八月放假时，停电天数
        for (int j = 0; j < d2.length; j++) {
            if (f8>=d2[j]){
                t8=j+1;
            }
        }
        int sum = t7+t8;
        System.out.println(sum);


//        int ge =0;
//        int ting = 1;
//        for (int i = 0; i < 62; i++) {
//            ting ++;
//            ge++;
//            i +=ge+1;
//        }
    }
}
